$(document).ready(function(){
    $(".father").click(function(e){
        var e=e||event;
        var nextAll=$(this).nextAll();
        var status=$(this).attr("status");
        for(var i=0;i<nextAll.length;i++){
            if(nextAll[i].className!="father"){
                nextAll[i].style.display=status=='on'?'none':'table-row';
                $(this).attr("status",status=='on'?'off':'on');
            }else{
                return false;
            }
        }
    });
    $(".firstChild").click(function(){
        var firstNext=$(this).nextAll(),
            status=$(this).attr("status");
        for(var i = 0,len = firstNext.length;i < len ; i++)
        {
            if(firstNext[i].className != 'secondChild'){
                return false;
            }
            firstNext[i].style.display= status == 'on' ? 'none' : 'table-row';
            $(this).attr("status",status == 'on' ? 'off' : 'on');
        }
        event.stopImmediatePropagation();
    });

    $(".black").on("click",function(){
        ShowTipBox();
        var id=$(this).attr("status");
        $(".a-confirm").on("click",function(){
            ajax("post","/menu/del-menu",{menu_id:id},function success(data){
                if(data.code==200){
                    layer.msg(data.msg);
                    setTimeout(function(){
                        location.reload();
                    },1200)
                }else{
                    layer.msg(data.msg)
                }
            },function error(data){
                layer.msg(data.msg)
            })
        });
        $(".a-cancel").on("click",function(){
            location.reload();
        });
    })
})